package com.itheima;

import com.itheima.config.AppConfig;
import com.itheima.domain.Goods;
import com.itheima.service.GoodsService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class App {
    public static void main(String[] args) {
        // ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
        GoodsService goodsService = (GoodsService) ctx.getBean("goodsService");

//        Map<String, Object> condition = new HashMap<String, Object>(2);
//        condition.put("startTime", "2021-10-21");
//        condition.put("endTime", "2021-10-30");
//        Map<String, Object> stringObjectMap = goodsService.select1(condition);
//
//        Set<String> strings = stringObjectMap.keySet();
//        for (String string : strings) {
//            System.out.println(string);
//        }

        List<Goods> list = goodsService.select4("华为");
        for (Goods goods : list) {
            System.out.println(goods.getGoodsName());
        }
    }
}
